package com;

import com.service.UserService;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class TextHelloSpring {
    public static void main(String[] args) {
        //初始化Spring容器 加载applicationContext.xml配置
        ApplicationContext applicationContext=new
                ClassPathXmlApplicationContext("applicationContext.xml");
        //通过容器获取配置中hellospring实例
        HelloSpring helloSpring=(HelloSpring)applicationContext.getBean("helloSpring");
        helloSpring.show();//调用方法
        //6-15测试
        UserService userService=(UserService)applicationContext.getBean("userService");
        boolean flag=userService.login("张三","123");
        if(flag){
            System.out.println("登录成功");
        }else{
            System.out.println("登录失败");
        }
    }
}
